<?php

defined('ACC')||exit('Access Denied');

class GoodsboxModel extends Model{
	
	/* 获取商品 */
	public function get_goods($search, $pageNow, $pageSize){
		$sql = 'select goods_id, goods_name, goods_thumb, market_price, shop_price from goods where is_' . $search . ' = 1 limit ' . (($pageNow-1)*$pageSize) . ',' . $pageSize;
		return $this->db->getAll($sql);
	}
	
	/* 获取商品并排序  */
	public function get_goods_sort($search, $sort, $pageNow, $pageSize){
		$sql = 'select goods_id, goods_name, goods_thumb, market_price, shop_price from goods where is_' . $search . ' = 1' . ' order by ' . $sort[0] . ' ' . $sort[1] . ' limit ' . (($pageNow-1)*$pageSize) . ',' . $pageSize;
		return $this->db->getAll($sql);
	}
	
	/* 获取商品总行数 */
	public function getRowCount3($search){
		$sql = 'select count(*) from goods where is_' . $search . '=1';
		return $this->db->getOne($sql);
	}
	
}





